Enumerating occurrences hangs..
Reported by Paul Dacus | August 5th, 2013 @ 06:36 PM
Building an RiCal.Event as follows:
=> BEGIN:VEVENT DTSTART;VALUE=DATE-TIME:20130805T153159Z
SUMMARY:Summary
RRULE:FREQ=MONTHLY
RRULE:FREQ=HOURLY
EXRULE:FREQ=HOURLY
END:VEVENT
The net result of this should be that the HOURLY EXRULE cancels out the HOURLY RRULE. It should generate monthly recurrences.
Per RFC 2445, page 112:
Multiple instances of the "RRULE" and
"EXRULE" properties can also be specified to define more
sophisticated recurrence sets. The final recurrence set is
generated by gathering all of the start date-times generated by any
of the specified "RRULE" and "RDATE" properties, and then excluding
any start date and times which fall within the union of start date
and times generated by any specified "EXRULE" and "EXDATE"
properties.
When I run the following, it hangs forever & pegs the CPU (I include CTRL-C):
1.9.3p286 :085 > ev.occurrences(:count => 10)
^CIRB::Abort: abort then interrupt!
from /home/paul/.rvm/gems/ruby-1.9.3-p286/gems/ri_cal-0.8.8/lib/ri_cal/fast_date_time.rb:74:in `call'
from /home/paul/.rvm/gems/ruby-1.9.3-p286/gems/ri_cal-0.8.8/lib/ri_cal/fast_date_time.rb:74:in `<=>'
from /home/paul/.rvm/gems/ruby-1.9.3-p286/gems/ri_cal-0.8.8/lib/ri_cal/property_value/date_time.rb:190:in `cmp_fast_date_time_value'
from /home/paul/.rvm/gems/ruby-1.9.3-p286/gems/ri_cal-0.8.8/lib/ri_cal/property_value/date_time.rb:186:in `<=>'
from /home/paul/.rvm/gems/ruby-1.9.3-p286/gems/ri_cal-0.8.8/lib/ri_cal/occurrence_enumerator.rb:86:in `<'
from /home/paul/.rvm/gems/ruby-1.9.3-p286/gems/ri_cal-0.8.8/lib/ri_cal/occurrence_enumerator.rb:86:in `exclusion_for'
from /home/paul/.rvm/gems/ruby-1.9.3-p286/gems/ri_cal-0.8.8/lib/ri_cal/occurrence_enumerator.rb:110:in `next_occurrence'
from /home/paul/.rvm/gems/ruby-1.9.3-p286/gems/ri_cal-0.8.8/lib/ri_cal/occurrence_enumerator.rb:137:in `each'
from /home/paul/.rvm/gems/ruby-1.9.3-p286/gems/ri_cal-0.8.8/lib/ri_cal/occurrence_enumerator.rb:173:in `to_a'
from /home/paul/.rvm/gems/ruby-1.9.3-p286/gems/ri_cal-0.8.8/lib/ri_cal/occurrence_enumerator.rb:173:in `to_a'
from /home/paul/.rvm/gems/ruby-1.9.3-p286/gems/ri_cal-0.8.8/lib/ri_cal/occurrence_enumerator.rb:193:in `occurrences'
from (irb):85
from /home/paul/.rvm/rubies/ruby-1.9.3-p286/bin/irb:16:in `<main>'
In my own testing, I found that removing the HOURLY EXRULE solves this. I found I can add DAILY or MONTHLY RRULES & corresponding EXRULE's, and these work fine. But in my own testing, any HOURLY EXRULE hangs a computation of occurrences.
Here is the console commands I used to produce:
1.9.3p286 :124 > ev = RiCal.Event
1.9.3p286 :124 > ev.summary = 'Summary'
1.9.3p286 :124 > ev.add_rrule({:freq => 'monthly'})
1.9.3p286 :124 > ev.add_rrule({:freq => 'hourly'})
1.9.3p286 :124 > ev.add_exrule({:freq => 'hourly'}
1.9.3p286 :124 > ev.dtstart = DateTime.now
1.9.3p286 :122 > ev.occurrences(:count => 1)
^CIRB::Abort: abort then interrupt!
from /home/paul/.rvm/gems/ruby-1.9.3-p286/gems/ri_cal-0.8.8/lib/ri_cal/fast_date_time.rb:73:in `call'
from /home/paul/.rvm/gems/ruby-1.9.3-p286/gems/ri_cal-0.8.8/lib/ri_cal/fast_date_time.rb:73:in `<=>'
from /home/paul/.rvm/gems/ruby-1.9.3-p286/gems/ri_cal-0.8.8/lib/ri_cal/property_value/date_time.rb:190:in `cmp_fast_date_time_value'
from /home/paul/.rvm/gems/ruby-1.9.3-p286/gems/ri_cal-0.8.8/lib/ri_cal/property_value/date_time.rb:186:in `<=>'
from /home/paul/.rvm/gems/ruby-1.9.3-p286/gems/ri_cal-0.8.8/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer.rb:101:in `update_cycle_range'
from /home/paul/.rvm/gems/ruby-1.9.3-p286/gems/ri_cal-0.8.8/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/frequency_incrementer.rb:64:in `next_cycle'
from /home/paul/.rvm/gems/ruby-1.9.3-p286/gems/ri_cal-0.8.8/lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer.rb:90:in `next_time'
from /home/paul/.rvm/gems/ruby-1.9.3-p286/gems/ri_cal-0.8.8/lib/ri_cal/property_value/recurrence_rule/enumerator.rb:69:in `next_occurrence'
from /home/paul/.rvm/gems/ruby-1.9.3-p286/gems/ri_cal-0.8.8/lib/ri_cal/occurrence_enumerator.rb:62:in `block in next_occurrence'
from /home/paul/.rvm/gems/ruby-1.9.3-p286/gems/ri_cal-0.8.8/lib/ri_cal/occurrence_enumerator.rb:62:in `each'
from /home/paul/.rvm/gems/ruby-1.9.3-p286/gems/ri_cal-0.8.8/lib/ri_cal/occurrence_enumerator.rb:62:in `each_with_index'
from /home/paul/.rvm/gems/ruby-1.9.3-p286/gems/ri_cal-0.8.8/lib/ri_cal/occurrence_enumerator.rb:62:in `next_occurrence'
from /home/paul/.rvm/gems/ruby-1.9.3-p286/gems/ri_cal-0.8.8/lib/ri_cal/occurrence_enumerator.rb:109:in `next_occurrence'
from /home/paul/.rvm/gems/ruby-1.9.3-p286/gems/ri_cal-0.8.8/lib/ri_cal/occurrence_enumerator.rb:137:in `each'
from /home/paul/.rvm/gems/ruby-1.9.3-p286/gems/ri_cal-0.8.8/lib/ri_cal/occurrence_enumerator.rb:173:in `to_a'
from /home/paul/.rvm/gems/ruby-1.9.3-p286/gems/ri_cal-0.8.8/lib/ri_cal/occurrence_enumerator.rb:173:in `to_a'
from /home/paul/.rvm/gems/ruby-1.9.3-p286/gems/ri_cal-0.8.8/lib/ri_cal/occurrence_enumerator.rb:193:in `occurrences'
from (irb):122
1.9.3p286 :124 > ev
=> BEGIN:VEVENT
DTSTART;VALUE=DATE-TIME:20130805T153159Z
SUMMARY:Summary
RRULE:FREQ=MONTHLY
RRULE:FREQ=HOURLY
EXRULE:FREQ=HOURLY
END:VEVENT
Thanks.
EDIT: I found similar behavior when adding SECONDLY, MINUTELY, or DAILY RRULE's and EXRULE's (with an existing MONTHLY RRULE). WEEKLY RRULE & EXRULE did not hang however.
No comments found
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
A new icalendar data (RFC 2445) gem for Ruby which supports time zones and enumeration of occurrences